package cn.fl.warrant.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import tc.esign.facade.esign.api.IFilSignApiService;
import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.warrant.service.IArcApplyDetailService;
import cn.fl.warrant.service.IArcLocalContractUserService;
import cn.fl.warrant.service.IArcMgrMainService;
import cn.fl.warrant.transform.ArcApplyDetailVOTransform;
import cn.fl.warrant.transform.ArcLocalContractUserVOTransform;
import cn.fl.warrant.transform.ArcMgrMainVOTransform;
import cn.fl.warrant.vo.ArcApplyDetailVO;
import cn.fl.warrant.vo.ArcLocalContractUserVO;
import cn.fl.warrant.vo.ArcMgrDetailVO;
import cn.fl.warrant.vo.ArcMgrMainVO;
import fl.warrant.facade.archive.api.IArcApplyDetailApiService;
import fl.warrant.facade.archive.api.IArcLocalContractUserApiService;
import fl.warrant.facade.archive.condition.ArcApplyDetailQC;
import fl.warrant.facade.archive.condition.ArcLocalContractUserQC;
import fl.warrant.facade.archive.dto.ArcApplyDetailDTO;
import fl.warrant.facade.archive.dto.ArcLocalContractUserDTO;
import fl.warrant.facade.archive.dto.ArcMgrMainDTO;

/**
 * @Description: 归档申请明细表(旧表：T_API_DOCUMENT_DOSSIERSTORAGE) 客户端服务层接口实现
 * @Description: 业务层方法名称前缀：新增：add* 删除：remove* 修改：modify* 查询对象：select* get* 批量：batch* 查询集合：search*
 */
@Service
public class ArcLocalContractUserServiceImpl implements IArcLocalContractUserService {

	/**
	 * 日志
	 */
	private static final Logger logger = LoggerFactory.getLogger(IArcLocalContractUserService.class);
	
	/**
	 * TODO 自定义 API 暴露服务
	 */
	@Autowired
	private IArcLocalContractUserApiService arcLocalContractUserApiService;
	
	
	
	/**
     * 删除
     * @param ids
     * @return
     */
    public boolean removeByIds(List<Long> ids)throws BaseException{
    	if(CollectionUtils.isEmpty(ids)){
    		BaseLogUtils.info(logger, "removeByIds", "删除主键参数集合不能为空!", CurrentThreadContext.getCurrentUserName());
			return false;
		};
		return false;
    }
	@Override
	public Pager searchListPage(Pager page) throws BaseException {
		if (null == page)
			page = new Pager();
		page = arcLocalContractUserApiService.searchListPage(page);
		List<ArcLocalContractUserDTO> DTDlist = (List<ArcLocalContractUserDTO>) page.getResultList();
		List<ArcLocalContractUserVO> list = ArcLocalContractUserVOTransform.toVOList(DTDlist);
		page.setResultList(list);
		return page;
	}
	@Override
	public ArcLocalContractUserVO selectById(Long id) throws BaseException {
		return ArcLocalContractUserVOTransform.toVO(arcLocalContractUserApiService.selectById(id))  ;
	}
	@Override
	public Long add(ArcLocalContractUserVO entity) throws BaseException {
		return arcLocalContractUserApiService.add(ArcLocalContractUserVOTransform.toDTO(entity));
	}
	@Override
	public boolean removeById(Long id) throws BaseException {
		return arcLocalContractUserApiService.removeById(id);
	}
	@Override
	public boolean modify(ArcLocalContractUserVO entity) throws BaseException {
		return arcLocalContractUserApiService.modify(ArcLocalContractUserVOTransform.toDTO(entity));
	}
	@Override
	public List<ArcLocalContractUserVO> searchList(ArcLocalContractUserQC qc) throws BaseException {
		String sysCd=CurrentThreadContext.getCurrentSysCd() ;
		String orgCd=CurrentThreadContext.getCurrentOrgCd();
		return ArcLocalContractUserVOTransform.toVOList(arcLocalContractUserApiService.searchList(qc,sysCd,orgCd));
	}


	
}
